import { Component, Injector, ViewChild, Input } from '@angular/core';
import { AppComponentBase } from '@shared/common/app-component-base';

import { UserServiceProxy } from '@shared/service-proxies/service-proxies';
import * as _ from 'lodash';

@Component({
    selector: 'app-OutsourcingWorkFlowDetailForm',
    templateUrl: './OutsourcingWorkFlowDetailForm.component.html',
    styleUrls: ['./OutsourcingWorkFlowDetailForm.component.css']
})
export class OutsourcingWorkFlowDetailFormComponent extends AppComponentBase {

    @Input() workflow: any;

    applyUseranme: string;

    constructor(injector: Injector,
        private _userServiceProxy: UserServiceProxy) { super(injector); }

    ngOnInit() {
        console.log(this.workflow);
        this.initForm();
    }

    initForm() {
        this._userServiceProxy.getUserInfo(this.workflow.createdUser)
            .subscribe(userResult => {
                this.applyUseranme = userResult.surname + userResult.name + '(' + userResult.userName + ')';
            });
    }
}
